﻿Public Class AppConstants

    Private Shared _die As Random

    Public Shared BasicStatPanelSize As Size = New Size(245, 275)
    Public Shared ReadOnly TagColumnName As String = "Tag"
    Public Shared ReadOnly ValueColumnName As String = "Value"
    Public Shared ReadOnly DisplayColumnName As String = "Display"

    Public Shared Function TranslateHeroClassName(ByVal classId As Short) As String

        Dim heroClassName As String = "Unknown"

        Select Case classId

            Case eHeroClass.Barbarian
                heroClassName = "Barbarian"

            Case eHeroClass.DwarvenWarrior
                heroClassName = "Dwarven Warrior"

            Case eHeroClass.ElvenWarrior
                heroClassName = "Elven Warrior"

            Case eHeroClass.Wizard
                heroClassName = "Wizard"

        End Select

        Return heroClassName

    End Function

    Public Shared Function TranslateMonsterTypeName(ByVal monsterTypeId As Short) As String

        Dim monsterTypeName As String = "Unknown"

        Select Case monsterTypeId

            Case MonsterObj.eMonsterType.None
                monsterTypeName = "(Select)" 'todo: change to None/unknown when datasources are complete

            Case MonsterObj.eMonsterType.Chaos
                monsterTypeName = "Chaos"

            Case MonsterObj.eMonsterType.ChaosDwarfs
                monsterTypeName = "Chaos Dwarfs"

            Case MonsterObj.eMonsterType.DarkElves
                monsterTypeName = "Dark Elves"

            Case MonsterObj.eMonsterType.Giants
                monsterTypeName = "Giants"

            Case MonsterObj.eMonsterType.Goblins
                monsterTypeName = "Goblins"

            Case MonsterObj.eMonsterType.Monsters
                monsterTypeName = "Monsters"

            Case MonsterObj.eMonsterType.Orcs
                monsterTypeName = "Orcs"

            Case MonsterObj.eMonsterType.Skaven
                monsterTypeName = "Skaven"

            Case MonsterObj.eMonsterType.Undead
                monsterTypeName = "Undead"

        End Select

        Return monsterTypeName

    End Function

    Public Shared Sub SetUpComboBox(ByVal cbo As ComboBox, ByVal dt As DataTable)

        cbo.DisplayMember = AppConstants.DisplayColumnName
        cbo.ValueMember = AppConstants.ValueColumnName
        cbo.DataSource = dt

        AddHandler cbo.KeyPress, AddressOf CboKeyPress
        AddHandler cbo.DropDown, AddressOf CboDropDownSelected

    End Sub

    Public Shared Function D6Roll() As Short

        If _die Is Nothing Then _die = New Random(Now.Millisecond)

        Dim value As Short = _die.Next(1, 7) '1-6

        Return value

    End Function

    Public Shared Function D10Roll() As Short

        If _die Is Nothing Then _die = New Random(Now.Millisecond)

        Dim value As Short = _die.Next(1, 11) '1-10

        Return value

    End Function

    Public Shared Function D100Roll() As Short

        If _die Is Nothing Then _die = New Random(Now.Millisecond)

        Dim value As Short = _die.Next(1, 101) '1-100

        Return value

    End Function

    Public Shared Function DxRoll(ByVal x As Short) As Short

        If _die Is Nothing Then _die = New Random(Now.Millisecond)

        Dim value As Short = _die.Next(1, x + 1)

        Return value

    End Function

#Region " Reusable Event Handlers "

    Private Shared Sub CboDropDownSelected(ByVal sender As Object, ByVal e As EventArgs)
        'todo
    End Sub

    Private Shared Sub CboKeyPress(ByVal sender As Object, ByVal e As EventArgs)
        'todo: go to next item based on letter typed
    End Sub

#End Region

#Region " Path Constants "

    Public Shared ReadOnly Property MonsterDesignerCsvPath() As String
        Get
            Return IO.Directory.GetCurrentDirectory.Replace("bin\Debug", "DataFiles\Monsters.csv")
        End Get
    End Property

    Public Shared ReadOnly Property HeroDesignerCsvPath() As String
        Get
            Return IO.Directory.GetCurrentDirectory.Replace("bin\Debug", "DataFiles\Heroes.csv")
        End Get
    End Property

#End Region

End Class
